//
//  ZGLOddsTabView.m
//  ZeegingLottery
//
//  Created by 蒂埃里 on 2018/4/14.
//  Copyright © 2018年 蒂埃里. All rights reserved.
//

#import "ZGLOddsTabView.h"
#import "ZGLOddsView.h"


@interface ZGLOddsTabView ()
{
    
}

@property (nonatomic, strong)ZGLOddsView *hadHomeWinView;     //
@property (nonatomic, strong)ZGLOddsView *hadAwayWinView;     //
@property (nonatomic, strong)ZGLOddsView *hadDrawView;                //胜平负
@property (nonatomic, strong)ZGLOddsView *hhadHomeWinView;    //
@property (nonatomic, strong)ZGLOddsView *hhadAwayWinView;
@property (nonatomic, strong)ZGLOddsView *hhadDrawView;               //让球胜平负

@property (nonatomic, strong)ZGLOddsView *NoSaleView;                //未开售

@property (nonatomic, strong)NSMutableArray *oddArray;        //传入赔率
@property (nonatomic, strong)NSMutableArray *stateArray;      //选中状态
@property (nonatomic, strong)NSMutableArray *betContentArray; //选中赔率
@property (strong, nonatomic)NSIndexPath *indexPath;          //传入下标

@end

@implementation ZGLOddsTabView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.backgroundColor = [UIColor yellowColor];
        
        [self setupUI];
        
        //2.监听清空通知，清空全部选择
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshTabview) name:ZGLCleanAllSelectOdd object:nil];
    }
    
    return self;
}

- (void)dealloc
{
    DLog(@"OddsView--释放");
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

- (NSMutableArray *)resetStateArr
{
    NSMutableArray *tempArr = [NSMutableArray array];
    for (int i = 0; i<6; i++) {
        NSString *selectState = @"0";
        [tempArr addObject:selectState];
        DLog(@"tempArr--%@",tempArr);
    }
    
    return tempArr;
}

//清空选择刷新表格
- (void)refreshTabview
{
    DLog(@"刷新赔率表格sub--%@",self.subviews);
    for (ZGLOddsView *buttton in self.subviews) {
        [buttton.oddsButton setSelected:NO];
    }
    [self.stateArray removeAllObjects];
    [self.betContentArray removeAllObjects];
    self.stateArray = [self resetStateArr];
    [self.Againstmodel setValue:_stateArray forKey:@"stateArray"];
}


- (void)setSelectStateArray:(NSMutableArray *)selectStateArray
{
    _selectStateArray = selectStateArray;
    for (ZGLOddsView *oddsView in self.subviews) {
        NSInteger tag = oddsView.oddsButton.tag;
        NSString *numStr = selectStateArray[tag];
        BOOL isSelected = [numStr integerValue];
        
        [oddsView.oddsButton setSelected:isSelected];
        
    }
 
}


- (NSIndexPath *)indexPath
{
    if (!_indexPath) {
        _indexPath  = [[NSIndexPath alloc]init];
    }
    return _indexPath;
}

//选中状态数组
- (NSMutableArray *)stateArray
{
    if (self.selectStateArray.count>0) {
//        [_stateArray removeAllObjects];
        self.stateArray = self.selectStateArray;
    }else{
        
        if (!_stateArray) {
            self.stateArray = [NSMutableArray array];
            for (int i = 0; i<6; i++) {
                NSString *isSelected = @"0";
                [self.stateArray addObject:isSelected];
                DLog(@"初始stateArray--%@",self.stateArray);
            }
        }
    }
    return _stateArray;
}

//odd数组
- (NSMutableArray *)oddArray
{
    if (!_oddArray) {
        _oddArray = [NSMutableArray array];
    }
    return _oddArray;
}

//betContentArr
- (NSMutableArray *)betContentArray
{
    if (!_betContentArray) {
        _betContentArray  = [NSMutableArray array];
    }
    return _betContentArray;
}

- (void)setAgainstmodel:(ZGLAgainstModel *)Againstmodel
{
    _Againstmodel = Againstmodel;
    self.indexPath = Againstmodel.indexPath;
    
    if (Againstmodel.betContentArray) {
        
//        [_betContentArray removeAllObjects];
        self.betContentArray = Againstmodel.betContentArray;
    }
    
}


- (void)setHadModel:(ZGLAgainstHadModel *)hadModel
{
    if (hadModel) {
        _hadModel = hadModel;
        
        NSString *homeWinStr = [self keepTwoDecimalPoint:hadModel.homewin];
        NSString *awayWinStr = [self keepTwoDecimalPoint:hadModel.awaywin];
        NSString *drawStr = [self keepTwoDecimalPoint:hadModel.draw];
        NSDictionary *hadHomeWinDict = @{
                                          @"id": @(354),
                                          @"selection" : @(3),
                                          @"odds" : homeWinStr
                                          };
        NSDictionary *hadAwayWinDcir = @{
                                          @"id": @(354),
                                          @"selection" : @(0),
                                          @"odds" : awayWinStr
                                          };
        NSDictionary *hadDrawDict = @{
                                       @"id": @(354),
                                       @"selection" : @(1),
                                       @"odds" : drawStr
                                       };
        NSArray *hadOddArr = @[hadHomeWinDict,hadDrawDict,hadAwayWinDcir];
        [self.oddArray addObjectsFromArray:hadOddArr];
        
        
        [self.hadHomeWinView.oddsButton buttonWithType:oddsButtonTextLabelHorizontall textString:@"主胜" subString:[NSString stringWithFormat:@"%@",homeWinStr]];
        [self.hadAwayWinView.oddsButton buttonWithType:oddsButtonTextLabelHorizontall textString:@"主负" subString:[NSString stringWithFormat:@"%@",awayWinStr]];
        [self.hadDrawView.oddsButton buttonWithType:oddsButtonTextLabelHorizontall textString:@"平" subString:[NSString stringWithFormat:@"%@",drawStr]];
        
    }else{
        [self.oddArray addObjectsFromArray:@[@"0",@"0",@"0"]];
        [self.hadHomeWinView setHidden:YES];
        [self.hadAwayWinView setHidden:YES];
        [self.hadDrawView setHidden:YES];
        [self.NoSaleView setHidden:NO];
        
    }
}

- (void)setHhadModel:(ZGLAgainstHHadModel *)hhadModel
{
    if (hhadModel) {
        _hhadModel = hhadModel;
        
//        "betContent\":
//        [{\"id\":354,\"selection\":3,\"odds\":\"2.34\"},
//         {\"id\":269,\"selection\":1,\"odds\":\"3.21\"}]
//        [self.jsonContentDict setValue:hhadModel.Handicap forKey:@"handicap"];
        NSString *homeWinStr = [self keepTwoDecimalPoint:hhadModel.homewin];
        NSString *awayWinStr = [self keepTwoDecimalPoint:hhadModel.awaywin];
        NSString *drawStr = [self keepTwoDecimalPoint:hhadModel.draw];
        NSDictionary *hhadHomeWinDict = @{
                                          @"id": @(269),
                                          @"selection" : @(3),
                                          @"odds" : homeWinStr
                                          };
        NSDictionary *hhadAwayWinDcir = @{
                                          @"id": @(269),
                                          @"selection" : @(0),
                                          @"odds" : awayWinStr
                                          };
        NSDictionary *hhadDrawDict = @{
                                       @"id": @(269),
                                       @"selection" : @(1),
                                       @"odds" : drawStr
                                       };
        NSArray *hhadOddArr = @[hhadHomeWinDict,hhadDrawDict,hhadAwayWinDcir];
        [self.oddArray addObjectsFromArray:hhadOddArr];
        
        
        
        [self.hhadHomeWinView.oddsButton buttonWithType:oddsButtonTextLabelHorizontall textString:@"主胜" subString:[NSString stringWithFormat:@"%@",homeWinStr]];
        [self.hhadAwayWinView.oddsButton buttonWithType:oddsButtonTextLabelHorizontall textString:@"主负" subString:[NSString stringWithFormat:@"%@",awayWinStr]];
        [_hhadDrawView.oddsButton buttonWithType:oddsButtonTextLabelHorizontall textString:@"平" subString:[NSString stringWithFormat:@"%@",drawStr]];
        
        if ([hhadModel.Handicap integerValue] < 0) {
            
            _hhadHomeWinView.typeLabel.text = [NSString stringWithFormat:@"主%@",hhadModel.Handicap];
            _hhadHomeWinView.typeLabel.backgroundColor = RGBACOLOR(26, 198, 4, 1.0);
            _hhadHomeWinView.typeLabel.textColor = [UIColor whiteColor];
            
        }else{
            
            _hhadHomeWinView.typeLabel.text = [NSString stringWithFormat:@"主+%@",hhadModel.Handicap];
            
        }
    }
}

//保留两位小数
- (NSString *)keepTwoDecimalPoint:(NSString *)string
{
     float i = string.floatValue;
    
    return [NSString stringWithFormat:@"%.2f",i];
}


#pragma mark - method

- (void)SelectButton:(UIButton *)sender
{
    
    BOOL IsChosed = self.Againstmodel.isSelected;

    NSInteger selectedCount = ApplicationDelegate.jsonContentArr.count;
    
    
    if (selectedCount < 8) {
        
        sender.selected = !sender.selected;
        
        NSInteger tag = sender.tag;
        NSDictionary *oddDict = nil;
        if (self.oddArray.count > 0) {
            
            oddDict = self.oddArray[tag];
        }
        
        //是否guts
        [self.Againstmodel setValue:@(0) forKey:@"guts"];
        
        DLog(@"self.betContentArray--%@",self.betContentArray);
        DLog(@"self.indexPath -- %@",self.indexPath);
        DLog(@"选中oddtag -- %ld",(long)sender.tag);
        
        if (sender.isSelected) {
            [self.stateArray replaceObjectAtIndex:tag withObject:@"1"];
            [self.betContentArray addObject:oddDict];
            
            DLog(@"stateArray--%@\n betContentArray--%@",self.stateArray,self.betContentArray);
            [self.Againstmodel setValue:self.stateArray forKey:@"stateArray"];
            [self.Againstmodel setValue:self.betContentArray forKey:@"betContentArray"];
            
            NSArray *tempArr = ApplicationDelegate.jsonContentArr.copy;
            __block NSInteger index;
            
            if (tempArr.count == 0) {
                
                [self.Againstmodel setIsSelected:YES];
                
                [ApplicationDelegate.jsonContentArr addObject:self.Againstmodel];
                
                
            }else{
                
                [tempArr enumerateObjectsUsingBlock:^(ZGLAgainstModel * model, NSUInteger idx, BOOL * _Nonnull stop) {
                    
                    if (model.id == self.Againstmodel.id) {
                        index = idx;
                        [ApplicationDelegate.jsonContentArr replaceObjectAtIndex:index withObject:self.Againstmodel];
                        *stop = YES;
                        return ;
                        
                    }
                    
                    if(idx == tempArr.count-1) {
                        
                        [self.Againstmodel setIsSelected:YES];
                        
                        [ApplicationDelegate.jsonContentArr addObject:self.Againstmodel];
                        
                    }
                    
                    
                }];
            }
            
            DLog(@"ApplicationDelegate.jsonContentArr.count--%ld",ApplicationDelegate.jsonContentArr.count);
            
            //返回选中比赛场数
            if (self.matchArrBlock) {
                self.matchArrBlock(ApplicationDelegate.jsonContentArr.count);
            }
            
            
            NSInteger count = ApplicationDelegate.jsonContentArr.count;
            NSDictionary *callBack = @{
                                       @"indexPath": self.indexPath,
                                       @"Againstmodel":self.Againstmodel,
                                       @"selectedCount": @(count)
                                       };
            //发通知
            [[NSNotificationCenter defaultCenter] postNotificationName:ZGLUpdateDataSource object:callBack];
            
        }else{
            DLog(@"取消选中赔率tag -- %ld",(long)sender.tag);
            
            [self.stateArray replaceObjectAtIndex:tag withObject:@"0"];
            [self.betContentArray removeObject:oddDict];
            DLog(@"stateArray--%@\n betContentArray--%@",self.stateArray,self.betContentArray);
            [self.Againstmodel setValue:self.stateArray forKey:@"stateArray"];
            [self.Againstmodel setValue:self.betContentArray forKey:@"betContentArray"];
            
            
            NSArray *tempArr = ApplicationDelegate.jsonContentArr.copy;
            __block NSInteger index;
            
            [tempArr enumerateObjectsUsingBlock:^(ZGLAgainstModel *model, NSUInteger idx, BOOL * _Nonnull stop) {
                
                if (model.id == self.Againstmodel.id) {
                    index = idx;
                    //不止选中一个
                    if (self.Againstmodel.betContentArray.count != 0) {
                        
                        //替换
                        [ApplicationDelegate.jsonContentArr replaceObjectAtIndex:index withObject:self.Againstmodel];
                        
                    }else{
                        
                        [self.Againstmodel setIsSelected:NO];
                        [ApplicationDelegate.jsonContentArr removeObjectAtIndex:index];
                        
                        
                        
                    }
                    return ;
                }
            }];
            
            DLog(@"ApplicationDelegate.jsonContentArr.count==%ld",ApplicationDelegate.jsonContentArr.count);
            
            //返回选中比赛场数
            if (self.matchArrBlock) {
                self.matchArrBlock(ApplicationDelegate.jsonContentArr.count);
            }
            
            
            NSInteger count = ApplicationDelegate.jsonContentArr.count;
            NSDictionary *callBack = @{
                                       @"indexPath": self.indexPath,
                                       @"Againstmodel":self.Againstmodel,
                                       @"selectedCount": @(count)
                                       };
            //发通知
            [[NSNotificationCenter defaultCenter] postNotificationName:ZGLUpdateDataSource object:callBack];
            
        }
        
    }else{
        
        //选择过
        if (IsChosed) {
            
            sender.selected = !sender.selected;
            
            NSInteger tag = sender.tag;
            NSDictionary *oddDict = nil;
            if (self.oddArray.count > 0) {
                
                oddDict = self.oddArray[tag];
            }
            
            //是否guts
            [self.Againstmodel setValue:@(0) forKey:@"guts"];
            
            DLog(@"self.betContentArray--%@",self.betContentArray);
            DLog(@"self.indexPath -- %@",self.indexPath);
            DLog(@"选中oddtag -- %ld",(long)sender.tag);
            
            if (sender.isSelected) {
                [self.stateArray replaceObjectAtIndex:tag withObject:@"1"];
                [self.betContentArray addObject:oddDict];
                
                DLog(@"stateArray--%@\n betContentArray--%@",self.stateArray,self.betContentArray);
                [self.Againstmodel setValue:self.stateArray forKey:@"stateArray"];
                [self.Againstmodel setValue:self.betContentArray forKey:@"betContentArray"];
                
                NSArray *tempArr = ApplicationDelegate.jsonContentArr.copy;
                __block NSInteger index;
                
                if (tempArr.count == 0) {
                    [ApplicationDelegate.jsonContentArr addObject:self.Againstmodel];
                    
                    
                }else{
                    
                    [tempArr enumerateObjectsUsingBlock:^(ZGLAgainstModel * model, NSUInteger idx, BOOL * _Nonnull stop) {
                        
                        if (model.id == self.Againstmodel.id) {
                            index = idx;
                            [ApplicationDelegate.jsonContentArr replaceObjectAtIndex:index withObject:self.Againstmodel];
                            *stop = YES;
                            return ;
                            
                        }
                        
                        if(idx == tempArr.count-1) {
                            
                            [ApplicationDelegate.jsonContentArr addObject:self.Againstmodel];
                            
                        }
                        
                        
                    }];
                }
                
                DLog(@"%ld",ApplicationDelegate.jsonContentArr.count);
                
                //返回选中比赛场数
                if (self.matchArrBlock) {
                    self.matchArrBlock(ApplicationDelegate.jsonContentArr.count);
                }
                
                
                NSInteger count = ApplicationDelegate.jsonContentArr.count;
                NSDictionary *callBack = @{
                                           @"indexPath": self.indexPath,
                                           @"Againstmodel":self.Againstmodel,
                                           @"selectedCount": @(count)
                                           };
                //发通知
                [[NSNotificationCenter defaultCenter] postNotificationName:ZGLUpdateDataSource object:callBack];
                
            }else{
                DLog(@"取消选中赔率tag -- %ld",(long)sender.tag);
                
                [self.stateArray replaceObjectAtIndex:tag withObject:@"0"];
                [self.betContentArray removeObject:oddDict];
                DLog(@"stateArray--%@\n betContentArray--%@",self.stateArray,self.betContentArray);
                [self.Againstmodel setValue:self.stateArray forKey:@"stateArray"];
                [self.Againstmodel setValue:self.betContentArray forKey:@"betContentArray"];
                
                
                NSArray *tempArr = ApplicationDelegate.jsonContentArr.copy;
                __block NSInteger index;
                
                [tempArr enumerateObjectsUsingBlock:^(ZGLAgainstModel *model, NSUInteger idx, BOOL * _Nonnull stop) {
                    
                    if (model.id == self.Againstmodel.id) {
                        index = idx;
                        //不止选中一个
                        if (self.Againstmodel.betContentArray.count != 0) {
                            
                            //替换
                            [ApplicationDelegate.jsonContentArr replaceObjectAtIndex:index withObject:self.Againstmodel];
                            
                        }else{
                            
                            [ApplicationDelegate.jsonContentArr removeObjectAtIndex:index];
                            
                            
                            
                        }
                        return ;
                    }
                }];
                
                DLog(@"ApplicationDelegate.jsonContentArr.count==%ld",ApplicationDelegate.jsonContentArr.count);
                
                //返回选中比赛场数
                if (self.matchArrBlock) {
                    self.matchArrBlock(ApplicationDelegate.jsonContentArr.count);
                }
                
                
                NSInteger count = ApplicationDelegate.jsonContentArr.count;
                NSDictionary *callBack = @{
                                           @"indexPath": self.indexPath,
                                           @"Againstmodel":self.Againstmodel,
                                           @"selectedCount": @(count)
                                           };
                //发通知
                [[NSNotificationCenter defaultCenter] postNotificationName:ZGLUpdateDataSource object:callBack];
                
                
            }
            
            
        }else{
            
            DLog(@"最多选择8场比赛");
            [EasyTextView showText:@"最多选择8场比赛" config:^EasyTextConfig *{
                
                EasyTextConfig *config = [EasyTextConfig shared];
                config.bgColor = [[UIColor lightGrayColor] colorWithAlphaComponent:0.7];
                config.animationType = TextAnimationTypeFade;
                config.statusType = TextStatusTypeBottom ;
                
                return config;
            }];
            
        }
        
        
    }
    
    
    
}



#pragma mark - getter

- (ZGLOddsView *)NoSaleView
{
    if (!_NoSaleView) {
        _NoSaleView = [[ZGLOddsView alloc]init];
        [_NoSaleView initWithType:oddsViewTypeButtonNoSale];
        
    }
    return _NoSaleView;
}

- (ZGLOddsView *)hadHomeWinView
{
    if (!_hadHomeWinView) {
        _hadHomeWinView = [[ZGLOddsView alloc]init];;
        [_hadHomeWinView initWithType:oddsViewTypeLabelAndButtonHorizontall];
        [_hadHomeWinView.oddsButton setTag:0];
        [_hadHomeWinView.oddsButton addTarget:self action:@selector(SelectButton:) forControlEvents:UIControlEventTouchUpInside];
        
    }
    
    return _hadHomeWinView;
}

- (ZGLOddsView *)hadAwayWinView
{
    if (!_hadAwayWinView) {
        _hadAwayWinView = [[ZGLOddsView alloc]init];
        [_hadAwayWinView initWithType:oddsViewTypeButtonHorizontall];
        [_hadAwayWinView.oddsButton setTag:2];
        [_hadAwayWinView.oddsButton addTarget:self action:@selector(SelectButton:) forControlEvents:UIControlEventTouchUpInside];
    }
    
    return _hadAwayWinView;
}

- (ZGLOddsView *)hadDrawView
{
    if (!_hadDrawView) {
        _hadDrawView = [[ZGLOddsView alloc]init];
        [_hadDrawView initWithType:oddsViewTypeButtonHorizontall];
        [_hadDrawView.oddsButton setTag:1];
        [_hadDrawView.oddsButton addTarget:self action:@selector(SelectButton:) forControlEvents:UIControlEventTouchUpInside];
    }
    
    return _hadDrawView;
}

- (ZGLOddsView *)hhadHomeWinView
{
    if (!_hhadHomeWinView) {
        _hhadHomeWinView = [[ZGLOddsView alloc]init];
        [_hhadHomeWinView initWithType:oddsViewTypeLabelAndButtonHorizontall];
        [_hhadHomeWinView.oddsButton setTag:3];
        [_hhadHomeWinView.oddsButton addTarget:self action:@selector(SelectButton:) forControlEvents:UIControlEventTouchUpInside];
    }
    
    return _hhadHomeWinView;
}

- (ZGLOddsView *)hhadAwayWinView
{
    if (!_hhadAwayWinView) {
        _hhadAwayWinView = [[ZGLOddsView alloc]init];
        [_hhadAwayWinView initWithType:oddsViewTypeButtonHorizontall];
        [_hhadAwayWinView.oddsButton setTag:5];
        [_hhadAwayWinView.oddsButton addTarget:self action:@selector(SelectButton:) forControlEvents:UIControlEventTouchUpInside];
    }
    
    return _hhadAwayWinView;
}

- (ZGLOddsView *)hhadDrawView
{
    if (!_hhadDrawView) {
        _hhadDrawView = [[ZGLOddsView alloc]init];
        [_hhadDrawView initWithType:oddsViewTypeButtonHorizontall];
        [_hhadDrawView.oddsButton setTag:4];
        [_hhadDrawView.oddsButton addTarget:self action:@selector(SelectButton:) forControlEvents:UIControlEventTouchUpInside];
    }
    
    return _hhadDrawView;
}

- (void)setupUI
{
    [self addSubview:self.hadHomeWinView];
    [self addSubview:self.hadAwayWinView];
    [self addSubview:self.hadDrawView];
    [self addSubview:self.hhadDrawView];
    [self addSubview:self.hhadAwayWinView];
    [self addSubview:self.hhadHomeWinView];
    [self addSubview:self.NoSaleView];

    CGFloat btnH = self.bounds.size.height/2;
    
    [_hadHomeWinView mas_makeConstraints:^(MASConstraintMaker *make) {

        make.top.equalTo(self);
        make.left.equalTo(self);
        make.height.equalTo(@(btnH + kBorderWidth));
        make.width.equalTo(_hadDrawView.mas_width).offset(15);
        
    }];
    //
    [_hadHomeWinView.oddsButton buttonWithType:oddsButtonTextLabelHorizontall textString:@"主胜" subString:@"10.0"];
    _hadHomeWinView.typeLabel.text = @"非让球";
    _hadHomeWinView.typeLabel.backgroundColor = sRGBHexAlpha(0xD0D5DA, 1.0);
    _hadHomeWinView.typeLabel.textColor = [UIColor whiteColor];
    
    
    [_hadAwayWinView mas_makeConstraints:^(MASConstraintMaker *make) {

        make.top.equalTo(self);
        make.left.equalTo(_hadDrawView.mas_right).offset(-kBorderWidth);
        make.right.equalTo(self);
        make.height.equalTo(_hadHomeWinView);
        make.width.equalTo(_hadDrawView);
    }];
    //
    [_hadAwayWinView.oddsButton buttonWithType:oddsButtonTextLabelHorizontall textString:@"主负" subString:@"11.0"];

    [_hadDrawView mas_makeConstraints:^(MASConstraintMaker *make) {

        make.top.equalTo(self);
        make.left.equalTo(_hadHomeWinView.mas_right).offset(-kBorderWidth);
        make.height.equalTo(_hadHomeWinView);
    }];
    //
    [_hadDrawView.oddsButton buttonWithType:oddsButtonTextLabelHorizontall textString:@"平" subString:@"9.0"];

    [_hhadHomeWinView mas_makeConstraints:^(MASConstraintMaker *make) {

        make.left.equalTo(self);
        make.bottom.equalTo(self);
        make.height.equalTo(_hadHomeWinView);
        make.width.equalTo(_hadHomeWinView);
    }];
    //
    [_hhadHomeWinView.oddsButton buttonWithType:oddsButtonTextLabelHorizontall textString:@"主胜" subString:@"10.0"];
    _hhadHomeWinView.typeLabel.text = @"主+1";
    _hhadHomeWinView.typeLabel.backgroundColor = RGBACOLOR(217, 63, 62, 1.0);
    _hhadHomeWinView.typeLabel.textColor = [UIColor whiteColor];

    [_hhadAwayWinView mas_makeConstraints:^(MASConstraintMaker *make) {


        make.right.equalTo(self);
        make.bottom.equalTo(self);
        make.height.equalTo(_hhadHomeWinView);
        make.width.equalTo(_hadAwayWinView);

    }];
    //
    [_hhadAwayWinView.oddsButton buttonWithType:oddsButtonTextLabelHorizontall textString:@"主负" subString:@"11.2"];

    [_hhadDrawView mas_makeConstraints:^(MASConstraintMaker *make) {

        make.bottom.equalTo(self);
        make.left.equalTo(_hhadHomeWinView.mas_right).offset(-kBorderWidth);
        make.right.equalTo(_hhadAwayWinView.mas_left).offset(kBorderWidth);
        make.height.equalTo(_hhadHomeWinView);

    }];
    //
    [_hhadDrawView.oddsButton buttonWithType:oddsButtonTextLabelHorizontall textString:@"平" subString:@"9.9"];
//
    [_NoSaleView mas_makeConstraints:^(MASConstraintMaker *make) {

        make.top.equalTo(self);
        make.left.equalTo(self);
        make.right.equalTo(self);
        make.height.mas_equalTo(btnH+0.5);
    }];
    _NoSaleView.typeLabel.text = @"非让球";
    _NoSaleView.typeLabel.backgroundColor = sRGBHexAlpha(0xD0D5DA, 1.0);
    _NoSaleView.typeLabel.textColor = [UIColor whiteColor];
    [_NoSaleView setHidden:YES];
    
}


@end
